@use 'sass:color';

@import '_variables';

$navbar-vertical-padding: 0.7rem;
$navbar-horizontal-padding: 1.5rem;

.navbar {
  padding: $navbar-vertical-padding $navbar-horizontal-padding;
  line-height: $navbarHeight - 1.4rem;
  box-shadow:5px 1px 10px rgb(240, 235, 235);
  background-color: #7b4cb8 !important;
  // opacity: 0.9;

  .logo {
    height: $navbarHeight - 1.4rem;
    min-width: $navbarHeight - 1.4rem;
    margin-right: 0.8rem;
    vertical-align: top;
  }

  .site-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: white !important;
    position: relative;
  }

  .navbar-links-wrapper {
    padding-left: 1.5rem;
    box-sizing: border-box;
    background-color: #7b4cb8 !important;
    color: white !important;
    white-space: nowrap;
    font-size: 0.9rem;
    position: absolute;
    right: $navbar-horizontal-padding;
    top: $navbar-vertical-padding;
    display: flex;
    .navbar-links-item > a:hover,
    .navbar-links-item > .router-link-active {
      color:white !important;
      margin-bottom: -4px !important;
      border-bottom: 1px solid #ffffff;
    }
    .dropdown-title {
      color: white !important;
      opacity: 0.5 !important;
      &:hover {
        color: white !important;
        opacity: 1 !important;
      }
    }
    .nav-dropdown {
      background-color: #7b4cb8 !important;
      box-sizing: border-box;
      border: none;
    }

    .search-box {
      flex: 0 0 auto;
      vertical-align: top;
    }
  }
}

@media (max-width: $MQMobile) {
  .navbar {
    padding-left: 4rem;

    .can-hide {
      display: none;
    }

    .navbar-links-wrapper {
      padding-left: 1.5rem;
    }

    .site-name {
      width: calc(100vw - 9.4rem);
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }
}

/**
 * navbar-links
 */
.navbar-links {
  display: inline-block;

  a {
    display: inline-block;
    line-height: 1.4rem;
    color: white !important;
    opacity: 0.5 !important;

    &:hover,
    &.router-link-active {
      color: white !important;
      opacity: 1 !important;
    }
  }

  .navbar-links-item {
    position: relative;
    display: inline-block;
    margin-left: 1.5rem;
    line-height: 2rem;

    &:first-child {
      margin-left: 0;
    }
  }
}

@media (max-width: $MQMobile) {
  .navbar-links {
    .navbar-links-item {
      margin-left: 0;
    }
  }
}

@media (min-width: $MQMobile) {
  .navbar-links a {
    &:hover,
    &.router-link-active {
      color: $textColor;
    }
  }

  .navbar-links-item > a:not(.external) {
    &:hover,
    &.router-link-active {
      margin-bottom: -2px;
      border-bottom: 2px solid color.scale($accentColor, $lightness: 8%);
    }
  }
}

/**
 * toggle sidebar button
 */
.toggle-sidebar-button {
  position: absolute;
  top: 0.6rem;
  left: 1rem;
  display: none;
  padding: 0.6rem;
  cursor: pointer;
}

.toggle-sidebar-button .icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

@media screen and (max-width: $MQMobile) {
  .toggle-sidebar-button {
    display: block;
  }
}
